/**
 * @author LKQ
 * @date 2021/12/24 21:15
 * @description
 */
public class Solution {
    public static void main(String[] args) {
        Solution solution = new Solution();
        System.out.println(solution.isUgly(14));
    }

    public boolean isUgly(int n) {
        if (n < 1) {
            return false;
        }
        while (n != 1) {
            if (n % 2 == 0 ) {
                n /= 2;
            }else if (n % 3 == 0) {
                n /= 3;
            }else if (n % 5 == 0) {
                n /= 5;
            }else {
                return false;
            }
        }
        return true;
    }
}
